package BookSystem.book;


/**
 * @author 兴趣使然黄小黄
 * @version 1.0
 */
public class BookList {

    private static final int DEFAULT_SIZE = 10;

//    private int factor;

    private Book[] books = new Book[DEFAULT_SIZE];

    private int useSize; // 记录当前数组中有多少本书

    public BookList() {
        books[0] = new Book("三国演义", "罗贯中", 89, "小说");
        books[1] = new Book("西游记", "吴承恩", 69, "小说");
        books[2] = new Book("红楼梦", "曹雪芹", 49, "小说");
        this.useSize = 3;
//        this.factor = 1;
    }

    public int getUseSize() {
        return useSize;
    }

    public void setUseSize(int useSize) {
        this.useSize = useSize;
    }

    public Book getBook(int pos){
        return books[pos];
    }

    public void setBook(Book book){
        books[useSize] = book;
    }

    public void setBook(int pos, Book book){
        books[pos] = book;
    }

//    // 查看是否需要扩容
//    private boolean check(int pos){
//        if (pos + 1 == factor * DEFAULT_SIZE){
//            return true;
//        }
//        return false;
//    }
}
